<template>
    <view class="container">
        <!-- <header-bar :config='config' ></header-bar> -->
        <scroll-view scroll-y>
            <view class="select-level" v-if="datas.length > 0">
                <view class="select-level-item" v-for="(item, index) in datas" @click="selectFn(item)">
                    <text class="select-level-item-name">{{ item.Title }}</text>
                    <view class="select-level-item-percent">
                        <view class="radio-yes" v-if="item.ID == id"><view></view></view>
                        <view class="radio-no" v-else></view>
                    </view>
                </view>
            </view>
            <mescroll-empty v-else :option="emptyOption"></mescroll-empty>
        </scroll-view>
    </view>
</template>

<script>
import { GetDealerGrades } from "@/pages_supplier/service/api/store.js"
export default {
    components: {},
    data() {
        return {
            config: {
                title: "选择单位",
                centerSlot: true,
            },
            datas: [],
            id: "",
        }
    },
    onLoad(e) {
        this.id = e.id
        //选中的排第一位
        this.datas = JSON.parse(e.data)
        // let move =  [...datas];
        // let add = [];
        // move.forEach((e,index)=>{
        // 	if(e.ID==this.id){
        // 		add = move.splice(index,1);
        // 	}
        // })
        // move.unshift(add[0]);
        // this.datas = move
    },
    mounted() {},
    onShow() {},
    methods: {
        selectFn(data) {
            const eventChannel = this.getOpenerEventChannel()
            eventChannel.emit("getSelectData", {
                ...data,
            })
            this.easyGoBack()
        },
    },
}
</script>

<style lang="scss">
.select-level {
    margin-top: $app-page-padding;
    background: #ffffff;
    padding: 0 $app-page-padding * 2;
}
.select-level-item {
    background: $color-white;
    border-bottom: solid 2rpx #ebebeb;
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 98rpx;
    &:last-child {
        border: none;
    }
    .select-level-item-name {
        flex: 1;
        font-size: 32rpx;
    }
}
</style>
